cmake_minimum_required(VERSION 3.8)
project(dnskv)

if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Debug")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -fmax-errors=5")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fmax-errors=5 -g -O0")

find_library(URING_LIBRARIES NAMES uring REQUIRED)

# define the key type of DNSKV globally
add_definitions(-DKEYTYPE=uint64_t)

include_directories(kvalloc/include)
include_directories(morphtree/include)
include_directories(tlbtree/include)

add_subdirectory(kvalloc)
add_subdirectory(morphtree)
add_subdirectory(tlbtree)

add_library(dnskv dnskv.cc)
target_link_libraries(dnskv uring kvalloc morphtree tlbtree)